﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Odbc;

namespace HitachiService.DBAccess
{
    public class DataAccess
    {
        private static OdbcConnection _connection = null;

        public static OdbcConnection GetConnection()
        {
            if (_connection == null)
            {
                String connStr = System.Configuration.ConfigurationManager.AppSettings["connectString"];
                _connection = new OdbcConnection(connStr);
            }
            return _connection;
        }

        protected static int ReadInt(object o)
        {
            return o == DBNull.Value ? 0 : (int)o;
        }

        protected static String ReadString(object o)
        {
            return o == DBNull.Value ? null : (String)o;
        }

    }
}